home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / listex / listex.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-04-20  |  13.4 KB  |  440 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    Caption         =   "ListEx Demo"
  6.    ClientHeight    =   5700
  7.    ClientLeft      =   240
  8.    ClientTop       =   540
  9.    ClientWidth     =   9285
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   0
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   6105
  21.    Left            =   180
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   380
  24.    ScaleMode       =   3  'Pixel
  25.    ScaleWidth      =   619
  26.    Top             =   195
  27.    Width           =   9405
  28.    Begin VB.CommandButton Cmd_Exit 
  29.       Appearance      =   0  'Flat
  30.       BackColor       =   &H80000005&
  31.       Caption         =   "E&xit"
  32.       Height          =   375
  33.       Left            =   5520
  34.       TabIndex        =   10
  35.       Top             =   5160
  36.       Width           =   975
  37.    End
  38.    Begin VB.DirListBox Dir1 
  39.       Appearance      =   0  'Flat
  40.       Height          =   930
  41.       Left            =   6720
  42.       TabIndex        =   8
  43.       Top             =   3720
  44.       Width           =   2295
  45.    End
  46.    Begin VB.FileListBox File1 
  47.       Appearance      =   0  'Flat
  48.       Height          =   420
  49.       Index           =   1
  50.       Left            =   3000
  51.       Pattern         =   "*.ico"
  52.       TabIndex        =   7
  53.       Top             =   5160
  54.       Visible         =   0   'False
  55.       Width           =   975
  56.    End
  57.    Begin VB.CommandButton Cmd_Add 
  58.       Appearance      =   0  'Flat
  59.       BackColor       =   &H80000005&
  60.       Caption         =   "Add Lines"
  61.       Height          =   375
  62.       Left            =   1560
  63.       TabIndex        =   6
  64.       Top             =   2760
  65.       Width           =   1215
  66.    End
  67.    Begin VB.FileListBox File1 
  68.       Appearance      =   0  'Flat
  69.       Height          =   420
  70.       Index           =   0
  71.       Left            =   1920
  72.       TabIndex        =   1
  73.       Top             =   5160
  74.       Visible         =   0   'False
  75.       Width           =   975
  76.    End
  77.    Begin VB.CommandButton Cmd_Load 
  78.       Appearance      =   0  'Flat
  79.       BackColor       =   &H80000005&
  80.       Caption         =   "Load Files"
  81.       Height          =   375
  82.       Left            =   240
  83.       TabIndex        =   0
  84.       Top             =   2760
  85.       Width           =   1215
  86.    End
  87.    Begin ListExLib.ListEx ListEx4 
  88.       Height          =   1455
  89.       Left            =   2040
  90.       TabIndex        =   14
  91.       Top             =   3480
  92.       Width           =   4335
  93.       _Version        =   65536
  94.       _ExtentX        =   7646
  95.       _ExtentY        =   2566
  96.       _StockProps     =   237
  97.       ForeColor       =   0
  98.       BackColor       =   16777215
  99.       BorderStyle     =   1
  100.       Appearance      =   1
  101.       ItemDefHeight   =   16
  102.       ImageOffset     =   0
  103.       TextOffset      =   0
  104.       SelectStyle     =   0   'False
  105.       NumTabs         =   0
  106.       Columns         =   0
  107.       MultiSelect     =   0
  108.       Sorted          =   0   'False
  109.       VerticalTextAlign=   1
  110.       VerticalImageAlign=   1
  111.       IntegralHeight  =   0   'False
  112.    End
  113.    Begin ListExLib.ListEx ListEx3 
  114.       Height          =   1455
  115.       Left            =   240
  116.       TabIndex        =   13
  117.       Top             =   3480
  118.       Width           =   1455
  119.       _Version        =   65536
  120.       _ExtentX        =   2566
  121.       _ExtentY        =   2566
  122.       _StockProps     =   237
  123.       ForeColor       =   0
  124.       BackColor       =   16777215
  125.       BorderStyle     =   1
  126.       Appearance      =   1
  127.       ItemDefHeight   =   16
  128.       ImageOffset     =   0
  129.       TextOffset      =   0
  130.       SelectStyle     =   -1  'True
  131.       NumTabs         =   0
  132.       Columns         =   0
  133.       MultiSelect     =   0
  134.       Sorted          =   0   'False
  135.       VerticalTextAlign=   1
  136.       VerticalImageAlign=   1
  137.       IntegralHeight  =   0   'False
  138.    End
  139.    Begin ListExLib.ListEx ListEx2 
  140.       Height          =   765
  141.       Left            =   6840
  142.       TabIndex        =   12
  143.       Top             =   4680
  144.       Width           =   2010
  145.       _Version        =   65536
  146.       _ExtentX        =   3545
  147.       _ExtentY        =   1349
  148.       _StockProps     =   237
  149.       ForeColor       =   0
  150.       BackColor       =   16777215
  151.       BorderStyle     =   1
  152.       Appearance      =   1
  153.       ItemDefHeight   =   32
  154.       ImageOffset     =   0
  155.       TextOffset      =   0
  156.       SelectStyle     =   0   'False
  157.       NumTabs         =   0
  158.       Columns         =   4
  159.       MultiSelect     =   0
  160.       Sorted          =   0   'False
  161.       VerticalTextAlign=   0
  162.       VerticalImageAlign=   0
  163.       IntegralHeight  =   0   'False
  164.    End
  165.    Begin ListExLib.ListEx ListEx1 
  166.       Height          =   2175
  167.       Left            =   240
  168.       TabIndex        =   11
  169.       Top             =   540
  170.       Width           =   8775
  171.       _Version        =   65536
  172.       _ExtentX        =   15478
  173.       _ExtentY        =   3836
  174.       _StockProps     =   237
  175.       ForeColor       =   0
  176.       BackColor       =   16777215
  177.       BorderStyle     =   1
  178.       Appearance      =   1
  179.       ItemDefHeight   =   16
  180.       ImageOffset     =   0
  181.       TextOffset      =   0
  182.       SelectStyle     =   0   'False
  183.       NumTabs         =   0
  184.       Columns         =   0
  185.       MultiSelect     =   2
  186.       Sorted          =   0   'False
  187.       VerticalTextAlign=   1
  188.       VerticalImageAlign=   1
  189.       IntegralHeight  =   -1  'True
  190.    End
  191.    Begin VB.Shape Shape4 
  192.       Height          =   1695
  193.       Left            =   1920
  194.       Top             =   3360
  195.       Width           =   4575
  196.    End
  197.    Begin VB.Image Img_Chk 
  198.       Appearance      =   0  'Flat
  199.       Height          =   165
  200.       Index           =   1
  201.       Left            =   660
  202.       Picture         =   "listex.frx":0000
  203.       Top             =   5280
  204.       Visible         =   0   'False
  205.       Width           =   180
  206.    End
  207.    Begin VB.Image Img_Chk 
  208.       Appearance      =   0  'Flat
  209.       Height          =   165
  210.       Index           =   0
  211.       Left            =   360
  212.       Picture         =   "listex.frx":049A
  213.       Top             =   5280
  214.       Visible         =   0   'False
  215.       Width           =   180
  216.    End
  217.    Begin VB.Shape Shape3 
  218.       Height          =   1695
  219.       Left            =   120
  220.       Top             =   3360
  221.       Width           =   1695
  222.    End
  223.    Begin VB.Shape Shape2 
  224.       BackColor       =   &H00C0C0C0&
  225.       Height          =   3135
  226.       Left            =   120
  227.       Top             =   120
  228.       Width           =   9015
  229.    End
  230.    Begin VB.Shape Shape1 
  231.       Height          =   2235
  232.       Left            =   6600
  233.       Top             =   3360
  234.       Width           =   2535
  235.    End
  236.    Begin VB.Label Lbl_File 
  237.       Appearance      =   0  'Flat
  238.       BackColor       =   &H00C0C0C0&
  239.       Caption         =   "ICON Directory"
  240.       ForeColor       =   &H80000008&
  241.       Height          =   255
  242.       Index           =   4
  243.       Left            =   6720
  244.       TabIndex        =   9
  245.       Top             =   3420
  246.       Width           =   2175
  247.    End
  248.    Begin VB.Image Img_Icons 
  249.       Appearance      =   0  'Flat
  250.       Height          =   180
  251.       Index           =   2
  252.       Left            =   1560
  253.       Picture         =   "listex.frx":0934
  254.       Top             =   5280
  255.       Visible         =   0   'False
  256.       Width           =   240
  257.    End
  258.    Begin VB.Image Img_Icons 
  259.       Appearance      =   0  'Flat
  260.       Height          =   210
  261.       Index           =   0
  262.       Left            =   960
  263.       Picture         =   "listex.frx":0E06
  264.       Top             =   5280
  265.       Visible         =   0   'False
  266.       Width           =   180
  267.    End
  268.    Begin VB.Image Img_Icons 
  269.       Appearance      =   0  'Flat
  270.       Height          =   210
  271.       Index           =   1
  272.       Left            =   1260
  273.       Picture         =   "listex.frx":12C0
  274.       Top             =   5280
  275.       Visible         =   0   'False
  276.       Width           =   180
  277.    End
  278.    Begin VB.Label Lbl_File 
  279.       Appearance      =   0  'Flat
  280.       BackColor       =   &H00C0C0C0&
  281.       Caption         =   "Creation Time"
  282.       ForeColor       =   &H80000008&
  283.       Height          =   255
  284.       Index           =   3
  285.       Left            =   7440
  286.       TabIndex        =   5
  287.       Top             =   240
  288.       Width           =   1215
  289.    End
  290.    Begin VB.Label Lbl_File 
  291.       Appearance      =   0  'Flat
  292.       BackColor       =   &H00C0C0C0&
  293.       Caption         =   "Creation Date"
  294.       ForeColor       =   &H80000008&
  295.       Height          =   255
  296.       Index           =   2
  297.       Left            =   6120
  298.       TabIndex        =   4
  299.       Top             =   240
  300.       Width           =   1215
  301.    End
  302.    Begin VB.Label Lbl_File 
  303.       Appearance      =   0  'Flat
  304.       BackColor       =   &H00C0C0C0&
  305.       Caption         =   "Size"
  306.       ForeColor       =   &H80000008&
  307.       Height          =   255
  308.       Index           =   1
  309.       Left            =   4740
  310.       TabIndex        =   3
  311.       Top             =   240
  312.       Width           =   1215
  313.    End
  314.    Begin VB.Label Lbl_File 
  315.       Appearance      =   0  'Flat
  316.       BackColor       =   &H00C0C0C0&
  317.       Caption         =   "File Name"
  318.       ForeColor       =   &H80000008&
  319.       Height          =   255
  320.       Index           =   0
  321.       Left            =   300
  322.       TabIndex        =   2
  323.       Top             =   240
  324.       Width           =   1215
  325.    End
  326. Attribute VB_Name = "Form1"
  327. Attribute VB_Creatable = False
  328. Attribute VB_Exposed = False
  329. Option Explicit
  330. DefInt A-Z
  331. ' LISTEX - Demo program for using the LISTEX.OCX control
  332. ' Joe C. Oliphant
  333. ' joe_oliphant@csufresno.edu
  334. ' CompuServe [71742,1451]
  335. Dim MaxWidth%
  336. Const LGHTGREY& = &HC0C0C0
  337. Const DRKGREY& = &H808080
  338. Private Sub Cmd_Add_Click()
  339.     Dim I
  340.     For I = 0 To ListEx1.ListCount - 1 Step 2
  341.     ListEx1.ItemBackColor(I) = LGHTGREY
  342.     If I + 1 < ListEx1.ListCount Then
  343.          ListEx1.ItemBackColor(I + 1) = DRKGREY
  344.     End If
  345.     Next I
  346. End Sub
  347. Private Sub Cmd_Exit_Click()
  348.     End
  349. End Sub
  350. Private Sub Cmd_Load_Click()
  351.     Dim A$, I%, J%, TB$, TimeStamp$, Ext$
  352.     TB$ = Chr$(9)
  353.     ListEx1.Clear
  354.     ListEx1.ImageOffset = 4
  355.     ListEx1.TextOffset = 24
  356.      
  357.     For I = 0 To File1(0).ListCount - 1
  358.     A$ = File1(0).List(I)
  359.     TimeStamp$ = FileDateTime(A$)
  360.     ListEx1.AddItem A$ & TB$ & Format$(FileLen(A$), "#,##0") & TB$ & Format$(TimeStamp$, "mm/dd/yy") & TB$ & Format$(TimeStamp$, "hh:mm:ss am/pm")
  361.     J = InStr(A$, ".")
  362.     Ext$ = ""
  363.     If J Then Ext$ = Mid$(A$, J + 1, 3)
  364.     Select Case Ext$
  365.     Case "wri", "txt", "doc"
  366.         ListEx1.ItemImage(I) = Img_Icons(1).Picture
  367.         ListEx1.ItemForeColor(I) = QBColor(1)
  368.     Case "bat", "com", "exe"
  369.         ListEx1.ItemImage(I) = Img_Icons(2).Picture
  370.         ListEx1.ItemForeColor(I) = QBColor(2)
  371.     Case Else
  372.         ListEx1.ItemImage(I) = Img_Icons(0).Picture
  373.     End Select
  374.     Next I
  375. End Sub
  376. Private Sub Dir1_Change()
  377.     Dim I, ICOFile$
  378.     Screen.MousePointer = 11
  379.     File1(1).Path = Dir1.Path
  380.     File1(1).Refresh
  381.     ListEx2.Clear
  382.     For I = 0 To File1(1).ListCount - 1
  383.     ICOFile$ = Dir1.Path & "\" & File1(1).List(I)
  384.     ListEx2.AddItem ""
  385.     ListEx2.ItemImage(I) = LoadPicture(ICOFile$)
  386.     Next I
  387.     Screen.MousePointer = 0
  388. End Sub
  389. Private Sub Form_Load()
  390.     Dim I, FntName$
  391.     ' Set tab stops in ListEx1 (- values for right justified)
  392.     ' Form1.ScaleMode is 3 (Pixel) to make thing easier
  393.     ListEx1.NumTabs = 3
  394.     ListEx1.TabStops(0) = (Lbl_File(1).Left + Lbl_File(1).Width - ListEx1.Left) * -1
  395.     ListEx1.TabStops(1) = (Lbl_File(2).Left + Lbl_File(2).Width - ListEx1.Left) * -1
  396.     ListEx1.TabStops(2) = (Lbl_File(3).Left + Lbl_File(3).Width - ListEx1.Left) * -1
  397.     ListEx3.ImageOffset = Img_Chk(0).Width * 0.25
  398.     ListEx3.TextOffset = Img_Chk(0).Width * 1.5
  399.     ListEx3.AddItem "Check Boxes"
  400.     ListEx3.ItemForeColor(0) = QBColor(1)
  401.     ListEx3.SelectEnable(0) = False
  402.     For I = 1 To 20
  403.     ListEx3.AddItem "Check " & Format$(I)
  404.     ListEx3.ItemImage(ListEx3.NewIndex) = Img_Chk(0).Picture
  405.     Next I
  406.     ListEx4.AddItem "Screen Fonts"
  407.     ListEx4.ItemForeColor(0) = QBColor(1)
  408.     ListEx4.SelectEnable(0) = False
  409.     ListEx4.ItemDefHeight = 18
  410.     For I = 1 To Screen.FontCount
  411.     FntName$ = Screen.Fonts(I)
  412.     If FntName$ <> "" Then
  413.         ListEx4.AddItem FntName$
  414.         With ListEx4.ItemFont(ListEx4.NewIndex)
  415.             .Name = FntName$
  416.             If I Mod 2 Then
  417.               .Italic = True
  418.               .Bold = False
  419.             Else
  420.               .Italic = False
  421.               .Bold = True
  422.             End If
  423.         End With
  424.     End If
  425.     Next I
  426. End Sub
  427. Private Sub ListEx3_MouseUp(Button As Integer, Shift As Integer, X As Single, y As Single)
  428.     Dim I
  429.     I = ListEx3.ListIndex
  430.     If I <= 0 Then Exit Sub
  431.     If X > (Img_Chk(0).Width * 1.25) * Screen.TwipsPerPixelX Then Exit Sub
  432.     If ListEx3.ItemData(I) Then
  433.         ListEx3.ItemImage(I) = Img_Chk(0).Picture
  434.         ListEx3.ItemData(I) = False
  435.     Else
  436.         ListEx3.ItemImage(I) = Img_Chk(1).Picture
  437.         ListEx3.ItemData(I) = True
  438.     End If
  439. End Sub
  440.